package com.smartapp.update;

import java.io.IOException;

import android.content.Context;
import android.util.Log;

public class BatchUtils {

	private native static int patchApk(String oldApkPath, String newApkPath,
			String patchPath);

	/**
	 * 根据context获取本app的旧版apk文件，与增量包合并生成新版apk
	 * 
	 * @param context
	 * @param newApkPath
	 *            新版apk文件路径
	 * @param patchPath
	 *            增量包路径
	 * @throws IOException
	 */
	public static int applyPatchToOwn(Context context, String newApkPath,
			String patchPath) throws IOException {
		String old = context.getApplicationInfo().sourceDir;

//		/data/app/~~iO9BrXq3i1kBkI3Yco-rMA==/com.smartapp.update-nNrJAGNBNNBLpdNHzy0mkg==/base.apk
		Log.e("applyPatchToOwn===1", "==="+old);

		return patchApk(old, newApkPath, patchPath);
	}
}
